import { isNumber, isString } from './utils';
export interface Styles {
  [key: string]: string | number;
}
export function getGlobalFontSize() {
  return document.documentElement.style.fontSize || '16px';
}
export function setRem(styles: Styles) {
  for (const key in styles) {
    const value = styles[key];
    if (isNumber(value)) {
      const rem = (value as number) / parseFloat(getGlobalFontSize());
      styles[key] = rem + 'rem';
    }
    if (!isNumber(value) && isString(value)) {
      styles[key] = value;
    }
  }
  return styles;
}
